﻿using System;

namespace Biblio2.LocalParsing
{
    public class Expression : IComparable
    {
        #region Attribut
        private bool m_bEnable;
        private int m_iIdExpression;
        private String m_sType;
        private String m_sExpression;
        #endregion Attribut

        #region Const
        public const String cType_Simple = "simple";
        public const String cType_Regexp = "regexp";
        #endregion Const

        #region Accesseurs
        public bool isEnabled { get { return m_bEnable; } }
        public int IdExpression { get { return m_iIdExpression; } }
        public String Type { get { return m_sType; } }
        public String ExpressionValue { get { return m_sExpression; } }
        #endregion Accesseurs

        #region Constructeurs
        public Expression(int ID, String type, String expression, bool isEnable)
        {
            m_bEnable = isEnable;
            m_iIdExpression = ID;
            m_sType = type;
            m_sExpression = expression;
        }

        public Expression(int ID, String type, String expression)
        {
            m_bEnable = true;
            m_iIdExpression = ID;
            m_sType = type;
            m_sExpression = expression;
        }
        #endregion Constructeurs

        #region IComparable Membres
        public int CompareTo(object obj)
        {
            try
            {
                return this.IdExpression.CompareTo(((Expression)obj).IdExpression);
            }
            catch (Exception) { }
            throw new NotImplementedException();
        }
        #endregion
    }
}
